// 小程序登录接口

import type { LoginResult } from "@/types/member"
import { http } from "@/utils/http"

// 小程序登录接口请求参数数据类型
type LoginParams = {
    code: string,
    encryptedData: string,
    iv: string
}

// 小程序登录接口
export const postLoginWxMinAPI = (data: LoginParams) => {
    return http<LoginResult>({
        method: 'POST',
        url: '/login/wxMin',
        data
    })
}

// 小程序登录接口-内测版-模拟手机号登录
export const postLoginWxMinSimpleAPI = (phoneNumber: string) => {
    return http<LoginResult>({
        method: 'POST',
        url: '/login/wxMin/simple',
        data: { phoneNumber }
    })
}

// 小程序登录接口-传统登录-用户名+密码
export const postLoginWxMinFormAPI = (data: {account: string, password: string}) => {
    return http<LoginResult>({
        method: 'POST',
        url: '/login',
        data
    })
}